Component({
  data: {
    selected: 0,
    color: "#7A7E83",
    selectedColor: "#3cc51f",
    role:'',
    allList:[{
      list1:[{
        "pagePath": "/pages/index/index",
        "text": "首页",
        "iconPath": "/img/index.png",
        "selectedIconPath": "/img/index_active.png"
      },
      {
        "pagePath": "/pages/my/my",
        "text": "我的",
        "iconPath": "/img/my.png",
        "selectedIconPath": "/img/my_active.png"
      }],
      list2:[{
        "pagePath": "/pages/admin/admin",
        "text": "首页",
        "iconPath": "/img/index.png",
        "selectedIconPath": "/img/index_active.png"
      },
        {
          "pagePath": "/pages/my/my",
          "text": "我的",
          "iconPath": "/img/my.png",
          "selectedIconPath": "/img/my_active.png"
        }
      ]

    }],
    list:[]
  },
  attached() {
    this.setData({
      role:wx.getStorageSync('role')
    })
    if(this.data.role=='stu'){

      this.setData({
        list:this.data.allList[0].list1
      })
    }else if(this.data.role=='adm'){
      this.setData({
        list:this.data.allList[0].list2
      })
    }
  },
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset
      const url = data.path
      wx.switchTab({url})
      this.setData({
        selected: data.index
      })
    }
  },


})